import { Tooltip } from 'antd';
import styles from './index.less' 

const Ellipsis = ({ text, width, hasTooltip = true }) => {
    const style = { width }
    const textDom = <div className={styles.text } style={style} >{text}</div>;
    if (hasTooltip) {
        return <Tooltip title={text}>{textDom}</Tooltip>
    }
    return textDom;
}

export default Ellipsis;